﻿@model IEnumerable<CofeWebApplication.ServiceReference1.CourseDTO>

@{
    ViewBag.Title = "Index";
}

    <div class="jumbotron-fluid">
        <h2 class="text-center" style="color:antiquewhite; text-shadow: 2px 2px 10px #000000; padding-top: 75px; font-size: 3.3vw">Courses</h2>
    </div>

<hr />

<div class="container">
    <p>
        @Html.ActionLink("Create New", "Create")

        @using (Html.BeginForm("Index", "Course", FormMethod.Get))
        {
        <p>
            Difficulty: @Html.DropDownList("difficulty", "All")
            Title: @Html.TextBox("searchName") @*<br />*@
            <input type="submit" value="Filter" />
        </p>
    }
        <table class="table">
            <tr>
                <th>

                </th>
                <th>
                    Course Name
                </th>
                <th>
                    Rating
                </th>
                <th>
                    Available Start Dates
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Length)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Difficulty)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.CourseType)
                </th>
                <th></th>
            </tr>

            @foreach (var item in Model)
            {
        <tr>
            <td>
                <img src="~/Content/Image/course.jpg" />
            </td>
            <td style="padding-top: 100px">
                <strong> @Html.DisplayFor(modelItem => item.Name)</strong>
            </td>
            <td style="padding-top: 100px">
                @Html.DisplayFor(modelItem => item.Rating) <span>/ 5</span>
            </td>
            <td style="padding-top: 100px">
                @Html.DisplayFor(modelItem => item.AvailableStartDates)
                10/10/2020
            </td>
            <td style="padding-top: 100px">
                @Html.DisplayFor(modelItem => item.Length)
            </td>
            <td style="padding-top: 100px">
                @Html.DisplayFor(modelItem => item.Difficulty)
            </td>
            

            <td style="padding-top: 100px">
                @if (User.IsInRole("Admin"))
                {
                    @Html.ActionLink("Edit", "Edit", new { id = item.Id }) <br />;
                    @Html.ActionLink("Delete", "Delete", new { id = item.Id });
                }
                @Html.ActionLink("Details", "Details", new { id = item.Id })
                @if (!User.IsInRole("Admin"))
                {
                        <span> |</span>
                        @Html.ActionLink("Add to Mug", "AddToBasket", new { id = item.Id })
                }
            </td>
        </tr>
            }

        </table>

    </div>

